package com.zy.learn.bean;

import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PreDestroy;

public class DestructionCallbackBean implements DisposableBean{

	/**
	 * Invoked by the containing {@code BeanFactory} on destruction of a bean.
	 *
	 * @throws Exception in case of shutdown errors. Exceptions will get logged
	 *                   but not rethrown to allow other beans to release their resources as well.
	 */
	@Override
	public void destroy() throws Exception {
		System.out.println("DestructionCallbackBean.destroy() ... implements DisposableBean");
	}

	@PreDestroy
	public void preDestroy(){
		System.out.println("DestructionCallbackBean.preDestroy() ... @PreDestroy");
	}

	public void cleanup(){
		System.out.println("DestructionCallbackBean.cleanup() ... Xml config");
	}


	/**
	 * @PosstConstruct和@PreDestroy是jdk的注解
	 *
	 */
}
